package main

import (
	"fmt"
	"reflect"
	"unicode/utf8"
)

var str string = "ab好"

func runetest() {

	fmt.Println(str)
	r := []rune(str)
	b := []byte(str)

	fmt.Println(reflect.TypeOf(b))
	fmt.Println(len(b))
	fmt.Println(len(r))
	fmt.Println(utf8.RuneCount(b))
}

func reversed(str string) string {
	a := []rune(str)
	for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
	return string(a)
}
func main() {

	fmt.Println(reversed("adbad好"))
	runetest()
}
